#ifndef __PERSONNAGE_H__
#define __PERSONNAGE_H__

#include <SDL.h>

#include "Observer.h"
#include "Global.h"
#include "Timer.h"

class Personnage : public IObserver
{
    public :
		Personnage(IObservable& oObservable) :	oObservable(oObservable),
			posX(0), posY(0), posPersoCamX(0), posPersoCamY(0), vitX(0), vitY(0), 
			direction(DIR_N), type(0), 
			frame(0), animMax(0),vitPersonnage(VIT_PERSONNAGE), imagePerso(NULL),
			bPauseJeu(false)
		{ oObservable.registerOb(this); };

		int& getPosX() { return posX; }
		int& getPosY() { return posY; }
		void setPos(int x, int y) { posX = x; posY = y; }

		virtual int getPersoW() = 0;
		virtual int getPersoH() = 0;

		virtual void draw(int camX, int camY) = 0;

		//int getdeplacX();
		//void setdeplacX(int i);

		//int getdeplacY();
		//void setdeplacY(int y);
        
		void update(bool bPause) { bPauseJeu = bPause; }
		
		TypeDirection getDirDeplac()         { return direction; };
		void setDirDeplac(TypeDirection dir) { direction = dir; };

		~Personnage()
		{ 
			SDL_FreeSurface(imagePerso); 
			oObservable.removeOb(this);
		}

	protected :
		bool bPauseJeu;

		SDL_Rect boiteCollision;

		int posX;
		int posY;
		int posPersoCamX;
		int posPersoCamY;

		//int hauteur;
		//int largeur;

		int vitX;
		int vitY;

		TypeDirection direction;

		int frame;
		int animMax;
		int type;

		int vitPersonnage;		//En pixels par seconde
		Timer anim;

		SDL_Surface* imagePerso;

		IObservable& oObservable;
};

#endif  //__PERSONNAGE_H__
